#ifndef FILESYSTEMMODEL_H
#define FILESYSTEMMODEL_H

#include <QDirModel>
#include <QFileSystemModel>

class FileSystemModel : public QFileSystemModel
{
    Q_OBJECT
    Q_PROPERTY(QModelIndex pathIndex READ pathIndex WRITE setPathIndex NOTIFY pathIndexChanged)
public:
    enum CustomRole{SizeRole = Qt::UserRole + 3, LastModifiedRole};
    explicit FileSystemModel(QObject *parent = 0);
    QVariant data(const QModelIndex &index, int role) const;
    void setPathIndex(const QModelIndex& index){mPathIndex = index;}
    const QModelIndex& pathIndex(){return mPathIndex;}

signals:
    void pathIndexChanged();

public slots:
    bool isDir(const QModelIndex &index  = QModelIndex())  const;
    QString filePath(const QModelIndex &index  = QModelIndex() ) const;
    void setDir(const QString& dir);

    void actionRename(const QModelIndex & index, const QString& name);
    void actionRemove(const QModelIndex & index);
    void actionMkdir(const QModelIndex & index, const QString& name);


private:
    QModelIndex mPathIndex;
};

#endif // FILESYSTEMMODEL_H
